/*
 * @Description  : 
 * @Date         : 2021-05-10 14:49:07
 * @Author       : 保锋
 * @LastEditTime : 2021-05-21 09:09:11
 * @LastEditors  : 保锋
 * @FilePath     : \caiying_flutter\lib\model\item_list_result_model.dart
 */

///项目列表返回模型
class ItemListResultModel {
  late int code;
  late String message;
  late Content content;

  ItemListResultModel(
      {required this.code, required this.message, required this.content});

  ItemListResultModel.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    message = json['message'];
    content = (json['content'] != null
        ? new Content.fromJson(json['content'])
        : null)!;
  }
}

class Content {
  late int total;
  late int page;
  late int perPage;
  late List<ItemItemModel> data;

  Content(
      {required this.total,
      required this.page,
      required this.perPage,
      required this.data});

  Content.fromJson(Map<String, dynamic> json) {
    total = json['total'];
    page = json['page'];
    perPage = json['per_page'];
    if (json['data'] != null) {
      data = <ItemItemModel>[];
      json['data'].forEach((v) {
        data.add(new ItemItemModel.fromJson(v));
      });
    }
  }
}

///项目模型
///
///[id]项目id
///
///[name]项目名称
///
///[adCode]行政区划编码
///
///[allMeter]所有水表
///
///[outMeter]正常上报水表
///
///[percent]上报率
class ItemItemModel {
  late int id;
  late String name;
  late String adCode;
  late int allMeter;
  late int outMeter;
  late double percent;
  ItemItemModel(
      {required this.id,
      required this.name,
      required this.adCode,
      required this.allMeter,
      required this.outMeter,
      required this.percent});

  ItemItemModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    adCode = json['ad_code'];
    allMeter = json['all_meter'];
    outMeter = json['out_meter'];
    percent = json['percent'];
  }
}
